package com.portico.dept.solarch

class ProjectForecast {

    String projectPhaseName ;

    Date phaseStartDate ;
    Date phaseEndDate ;

  // Pre Design
    long  estimatedEffortInHours ;
    float estimatedEffortInDollars;

  // Post design
    long  forecastEffortInHours; 
    float forecastEffortInDollars;

    long  remainingEffortInHours ;
    float remainingEffortInDollars;

    static constraints = {
      projectPhaseName(blank:false)
      phaseStartDate(blank:false)
      phaseEndDate( validator:{
        endDate, obj ->
          if( endDate != null) {
            return endDate.after(obj.phaseStartDate)
          }
        return true ;
      })
    }
  
  static belongsTo = [project: Project]
}
